package myky.com.doctorapp.presenter;

import android.annotation.SuppressLint;

import java.util.List;

import io.reactivex.Observable;
import io.reactivex.ObservableSource;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
import myky.com.doctorapp.base.BaseEntity;
import myky.com.doctorapp.entity.AuthorListEntity;
import myky.com.doctorapp.base.BasePresenterIm;
import myky.com.doctorapp.base.RxSubscribe;
import myky.com.doctorapp.contract.AuthorListActivityContract;
import myky.com.doctorapp.model.AuthorListActivityModel;

public class AuthorListActivityPresenter extends BasePresenterIm<AuthorListActivityContract.View>implements AuthorListActivityContract.Presenter {


    AuthorListActivityModel listActivityModel;
    public AuthorListActivityPresenter() {
        listActivityModel=new AuthorListActivityModel();
    }

    @SuppressLint("CheckResult")
    @Override
    public void pgetAuthorList(String version) {
        Observable<BaseEntity<List<AuthorListEntity.DataBean>>> authorList = listActivityModel.getAuthorList(version);


        listActivityModel.getAuthorList(version).subscribe(new RxSubscribe<List<AuthorListEntity.DataBean>>() {
            @Override
            protected void onSuccess(List<AuthorListEntity.DataBean> dataBeans) {
                mView.showDataSuccess(dataBeans);
            }

            @Override
            protected void onFailed(int code, String msg) {

            }

            @Override
            public void onSubscribe(Disposable d) {

            }
        });
    }
}
